Telegram Group & Telegram Channel
🚀 Как ускорить Python-код для ресурсоёмких задач

При работе с большими объёмами данных Python может «тормозить», особенно при обработке сотен тысяч строк или обучении сложных ML-моделей.

🎯 Ниже — два приёма, которые позволят ускорить обучение и загрузку данных в десятки раз.

1️⃣ Используйте GPU с включённым memory growth

По умолчанию TensorFlow может попытаться занять всю память видеокарты, что приводит к ошибке OOM. Решение — включить «постепенное» выделение памяти:
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)


2️⃣ Оптимизируйте загрузку данных с `tf.data`

Загрузка Excel-файла — типичное узкое место (Disk I/O). Использование tf.data.Dataset с prefetch позволяет загружать и обрабатывать данные асинхронно.

Пример:
dataset = tf.data.Dataset.from_generator(
data_generator,
output_signature={col: tf.TensorSpec(shape=(), dtype=tf.float32) for col in data.columns}
).shuffle(1000).batch(32).prefetch(tf.data.AUTOTUNE)


📎 Вывод:
GPU и tf.data с правильной настройкой дают мощный прирост производительности. Особенно важно при работе с крупными ML-пайплайнами и в продакшене.

Библиотека дата-сайентиста #буст
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/dsproglib/6445
Create:
Last Update:

🚀 Как ускорить Python-код для ресурсоёмких задач

При работе с большими объёмами данных Python может «тормозить», особенно при обработке сотен тысяч строк или обучении сложных ML-моделей.

🎯 Ниже — два приёма, которые позволят ускорить обучение и загрузку данных в десятки раз.

1️⃣ Используйте GPU с включённым memory growth

По умолчанию TensorFlow может попытаться занять всю память видеокарты, что приводит к ошибке OOM. Решение — включить «постепенное» выделение памяти:

gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)


2️⃣ Оптимизируйте загрузку данных с `tf.data`

Загрузка Excel-файла — типичное узкое место (Disk I/O). Использование tf.data.Dataset с prefetch позволяет загружать и обрабатывать данные асинхронно.

Пример:
dataset = tf.data.Dataset.from_generator(
data_generator,
output_signature={col: tf.TensorSpec(shape=(), dtype=tf.float32) for col in data.columns}
).shuffle(1000).batch(32).prefetch(tf.data.AUTOTUNE)


📎 Вывод:
GPU и tf.data с правильной настройкой дают мощный прирост производительности. Особенно важно при работе с крупными ML-пайплайнами и в продакшене.

Библиотека дата-сайентиста #буст

BY Библиотека дата-сайентиста | Data Science, Machine learning, анализ данных, машинное обучение




Share with your friend now:
tg-me.com/dsproglib/6445

View MORE
Open in Telegram


Библиотека data scientist’а | Data Science Machine learning анализ данных машинное обучение Telegram | DID YOU KNOW?

Date: |

How to Use Bitcoin?

n the U.S. people generally use Bitcoin as an alternative investment, helping diversify a portfolio apart from stocks and bonds. You can also use Bitcoin to make purchases, but the number of vendors that accept the cryptocurrency is still limited. Big companies that accept Bitcoin include Overstock, AT&T and Twitch. You may also find that some small local retailers or certain websites take Bitcoin, but you’ll have to do some digging. That said, PayPal has announced that it will enable cryptocurrency as a funding source for purchases this year, financing purchases by automatically converting crypto holdings to fiat currency for users. “They have 346 million users and they’re connected to 26 million merchants,” says Spencer Montgomery, founder of Uinta Crypto Consulting. “It’s huge.”

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

Библиотека data scientist’а | Data Science Machine learning анализ данных машинное обучение from tr


Telegram Библиотека дата-сайентиста | Data Science, Machine learning, анализ данных, машинное обучение
FROM USA